
* ================================================
* File: main.do
* Built: Stata 14
* Authors: Patrick Bayer and Alexander Ovodenko
* Purpose: Code to reproduce main results
* Input: fracking.dta
*
* This version: 8 July 2019
*
* PLEASE CITE:
* Patrick Bayer and Alexander Ovodenke. 2019. "Many voices in the room: 
* A national survey experiment on how framing changes views toward fracking 
* in the United States." Energy Research & Social Science.
*
* ================================================

clear all
set more off, permanently

use "./fracking.dta"

* Group treatment groups into single and mixed frames
gen groupdisplay1=0
label variable groupdisplay1 "Group of single frames"
replace groupdisplay1=1 if T1==1 | T2==1 | T3==1 | T4==1 | T5==1 | T6==1

gen groupdisplay2=0
label variable groupdisplay2 "Group of mixed frames"
replace groupdisplay2=1 if T1==1 | T7==1 | T8==1 | T9==1 | T10==1 | T11==1 | T12==1

* Set survey weights
svyset wustlid [pweight=apr2016wt1]

* ================================================
* Data for main results plots
* ================================================

* Plot for single frames (Figure 1)
ttest frackDV if T1==1 | T2==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T3==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T4==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T5==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T6==1, by(DOV_GROUPF)

* Plot for mixed frames (Figure 2)
ttest frackDV if T1==1 | T7==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T8==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T9==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T10==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T11==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T12==1, by(DOV_GROUPF)

 

* ================================================
* Main results (without and with survey weights)
* ================================================

* Testing significance across conditions without survey weights
ttest frackDV if T1==1 | T2==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T3==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T4==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T5==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T6==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T7==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T8==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T9==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T10==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T11==1, by(DOV_GROUPF)
ttest frackDV if T1==1 | T12==1, by(DOV_GROUPF)


* Testing significance across conditions using survey weights
svy: mean frackDV if T1==1 | T2==1, over(T1 T2)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T3==1, over(T1 T3)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T4==1, over(T1 T4)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T5==1, over(T1 T5)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T6==1, over(T1 T6)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T7==1, over(T1 T7)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T8==1, over(T1 T8)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T9==1, over(T1 T9)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T10==1, over(T1 T10)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T11==1, over(T1 T11)
test [frackDV]_subpop_1=[frackDV]_subpop_2

svy: mean frackDV if T1==1 | T12==1, over(T1 T12)
test [frackDV]_subpop_1=[frackDV]_subpop_2


* ================================================
* Main results: Substantive changes
* ================================================

ttest frackDV if T1==1 | T12==1, by(DOV_GROUPF)

* Anti-fracking frames
di (2.427481/3.327731)-1
di (2.682692/3.327731)-1
di (2.772277/3.327731)-1

* Pro-fracking frames
di (3.784/3.327731)-1
di (3.758333/3.327731)-1

* Mixed frames
di (3.076923/3.327731)-1
di (2.601626/3.327731)-1
di (3.096774/3.327731)-1
di (3.07438/3.327731)-1
di (3.165468/3.327731)-1
di (2.889831/3.327731)-1



* ================================================
* Results for conditional effect of fracking knowledge
* ================================================

label variable T2 "Water"
label variable T3 "Uncertainty"
label variable T4 "Diversion"
label variable T5 "Jobs"
label variable T6 "Energy security"
label variable T7 "Water+Jobs"
label variable T8 "Water+Energy security"
label variable T9 "Uncertainty+Jobs"
label variable T10 "Uncertainty+Energy security"
label variable T11 "Diversion+Jobs"
label variable T12 "Diversion+Energy security"

* Knowledge index variable (technical, economic, and environmental knowledge)

gen highknow=.
replace highknow=0 if fracking_knowledge==0 | fracking_knowledge==1
replace highknow=1 if fracking_knowledge==2

label variable highknow "High knowledge"

eststo clear
eststo: xi: reg frackDV (T2-T12)##highknow i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##highknow saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##highknow saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/* 
esttab using "../../Paper/hetero_knowledge.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/ 

* Technical knowledge separately

gen techhigh=.
replace techhigh=1 if tech>=5 & tech!=.
replace techhigh=0 if tech<5 & tech!=.
label variable techhigh "High technical knowledge"

eststo clear
eststo: xi: reg frackDV (T2-T12)##techhigh i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##techhigh saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##techhigh saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/techhigh.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errrors.")
*/


* Economic knowledge separately

gen econhigh=.
replace econhigh=1 if econ>=5 & econ!=.
replace econhigh=0 if econ<5 & econ!=.
label variable econhigh "High economic knowledge"

eststo clear
eststo: xi: reg frackDV (T2-T12)##econhigh i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##econhigh saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##econhigh saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/econhigh.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/

* Environmental knowledge separately

gen envhigh=.
replace envhigh=1 if env>=5 & env!=.
replace envhigh=0 if env<5 & env!=.
label variable envhigh "High environmental knowledge"

eststo clear
eststo: xi: reg frackDV (T2-T12)##envhigh i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##envhigh saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##envhigh saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/envhigh.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/


* Lack of knowledge variable

tab heardfracking if DOV_GROUPF!=.

gen nopriorknow=0
replace nopriorknow=1 if FRACK7S50=="" & FRACK8S50=="" & pre_treatment_DK!=1
replace nopriorknow=1 if pre_treatment_DK==1
replace nopriorknow=. if DOV_GROUPF==.

label variable nopriorknow "No prior knowledge"

eststo clear
eststo: xi: reg frackDV (T2-T12)##nopriorknow i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##nopriorknow saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##nopriorknow saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/nopriorknow.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/

pwcorr nopriorknow fracking_knowledge, sig


* ================================================
* Results for conditional effect of congruent knowledge
* ================================================

* Coding of conditioning variables
label variable pre_treatment_T2 "Pre-treatment: Water"
label variable pre_treatment_T3 "Pre-treatment: Uncertainty"
label variable pre_treatment_T4 "Pre-treatment: Diversion"
label variable pre_treatment_T5 "Pre-treatment: Jobs"
label variable pre_treatment_T6 "Pre-treatment: Energy security"

* Pre-treatment T2: Water
eststo clear
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T2 i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T2 fracking_knowledge saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T2 fracking_knowledge saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/preT2.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/

* Pre-treatment T3: Uncertainty
eststo clear
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T3 i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T3 fracking_knowledge saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T3 fracking_knowledge saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/preT3.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/


* Pre-treatment T5: Jobs
eststo clear
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T5 i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T5 fracking_knowledge saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T5 fracking_knowledge saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/preT5.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/

* Pre-treatment T6: Energy security
eststo clear
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T6 i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T6 fracking_knowledge saliency i.stateid, robust
eststo: xi: reg frackDV (T2-T12)##pre_treatment_T6 fracking_knowledge saliency frackopinion economic_situation global_warming age female republican democrat household_income political_interest shale_state i.stateid, robust

/*
esttab using "../../Paper/preT6.tex", label nobaselevels interaction(" $\times$ ")style(tex) ///
stats(N, labels("Observations") fmt(0)) cells("b(star fmt(%9.3f)) se")  ///
se nonotes legend star(* 0.10 ** 0.05 *** 0.01) replace booktabs drop(_Istateid_* _cons) ///
mtitles("Model" "Model" "Model") addnote ("Dependent Variable: Fracking support (1-6 scale). Higher values indicate more support for fracking." "All models with state fixed effects and robust standard errors.")
*/

* ================================================
* 					END OF FILE
* ================================================
